s = 'helloworldhelloworlddsadsadsa'
new_s = ''

# (1) 字符串的拼接及 not in
for item in s:
    if item not in new_s:  # 判断s中的每个字符在new_s中是否存在
        new_s += item

print(new_s)

# (2) 使用索引 not in
new_s2 = ''
for i in range(len(s)):
    if s[i] not in new_s2:
        new_s2 += s[i]
print(new_s2)

# (3) 通过集合去重 + 列表排序
new_s3 = set(s)  # 集合类型
lst = list(new_s3)
lst.sort(key=s.index)  # 排序的关键字
print(''.join(lst))